<%--
  Created by IntelliJ IDEA.
  User: 26056
  Date: 2021/5/4
  Time: 17:17
  To change this template use File | Settings | File Templates.
--%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<script type="text/javascript" src="../jquery-3.3.1.min.js"></script>

<html>
<head>

    <title>账户管理</title>

        <script>
        var state = ${state};
        $(function () {
            if (state == "1") {
                $("#collection").attr("style", "display:block");
                $("#logout").attr("style", "display:block");
                $("#write").attr("style", "display:none");
                $("#manage").attr("style", "display:none");
                $("#Editor").attr("style", "display:none");
                $("#UserComm").attr("style", "display:block");
                $("#Comment").attr("style", "display:none");
            }
                else if(state == "2") {
                    $("#write").attr("style", "display:block");
                    $("#collection").attr("style", "display:block");
                    $("#logout").attr("style", "display:block");
                    $("#manage").attr("style", "display:block");
                $("#Editor").attr("style", "display:block");
                $("#UserComm").attr("style", "display:none");
                $("#Comment").attr("style", "display:block");
                }
            else {
                $("#collection").attr("style", "display:none");
                $("#logout").attr("style", "display:none");
                $("#write").attr("style", "display:none");
                $("#manage").attr("style", "display:none");
                $("#Editor").attr("style", "display:none");
                $("#UserComm").attr("style", "display:none");
                $("#Comment").attr("style", "display:none");
                alert("你还没登录哦~");
            }
        })

    </script>

</head>

<body>

<tr>
    <td>
        <div><%=request.getSession().getAttribute("user") == null ? "你好，游客" : "你好，用户："+request.getSession().getAttribute("username") %></div>
    </td>

    <td>
        <form id="collection" action="/CollectionData" method="post">
            <input type="hidden" name="user" value=${user}>
            <input type="submit" value="收藏">
        </form>
    </td>

    <td>
        <form action="/login/login.jsp" method="post">
            <input type="submit" value="登录">
        </form>
    </td>

    <td>
        <form id="logout" action="/logout" method="post">
            <input type="submit" value="退出登录">
        </form>
    </td>

    <td>
        <form id="write" action="/DispachWrite" method="post">
            <input type="submit" value="编写文章">
        </form>
    </td>

    <td>
        <form id="manage" action="/DispachManage" method="post">
            <input type="submit" value="管理文章">
        </form>
    </td>

    <td>
        <form id="Editor" action="/DispachAns" method="post">
            <input type="submit" value="管理提问">
        </form>
    </td>

    <td>
        <form id="UserComm" action="/DispachAnswered" method="post">
            <input type="submit" value="查看回答">
        </form>
    </td>

    <td>
        <form id="Comment" action="/DispachCommentManage" method="post">
            <input type="submit" value="管理评论">
        </form>
    </td>

    <td>
        <form action="/../index.jsp" method="post">
        <input type="submit" value="返回">
        </form>
    </td>

</tr>

</body>
</html>
